/*
 * This file is part of ksPlatform
 * 
 * Copyright (c) 2014-2015
 * 
 * This file is dual-licensed under the AGPLv3 (http://www.gnu.org/licenses/agpl-3.0.html) 
 * 
 * If you are unsure which license is appropriate for your use, please contact the sales department
 * at 97041437@qq.com.
 */
package cn.com.ksplatform.core.context;

import cn.com.ksplatform.common.util.SystemStatu;
import cn.com.ksplatform.core.expand.spring.SpringContext;

/**
 * 研发平台上下文
 * 
 * PlatformContext
 * 
 * 2015年3月17日 下午4:57:07
 * @author Mr.Xiao
 * @version 1.0.0
 *
 */
public class PlatformContext {
	/**
	 * Spring上下文
	 */
	public static SpringContext SPRING_CONTEXT;
	
	/**
	 * 上下文路径
	 */
	public static String CONTEXT_PATH;
	
	/**
	 * 系统状态
	 */
	public static SystemStatu SYSTEMSTATU;
	
	/**
	 * 获取Bean
	 * getBean()
	 * @param beanName
	 * @return Object
	 * @exception 
	 * @since  1.0.0
	 */
	public static Object getBean(String beanName){
		return (SPRING_CONTEXT).getBean(beanName);
	}
	
	/**
	 * 获取Bean
	 * getBean()
	 * (这里描述这个方法适用条件 – 可选)
	 * @param beanName
	 * @param clazz
	 * @return Object
	 * @exception 
	 * @since  1.0.0
	 */
	@SuppressWarnings("unchecked")
	public static <T> T getBean(String beanName,Class<T> requiredType){
		return (T)(SPRING_CONTEXT).getBean(beanName);
	}
	
	/**
	 * 获取Bean
	 * @param requiredType
	 * @return
	 */
	public static <T> T getBean(Class<T> requiredType){
		return (T)(SPRING_CONTEXT).getBean(requiredType);
	}
	
}
